package vectortile.layer;

import com.google.protobuf.*;
import vectortile.feature.Feature;
import vectortile.feature.FeatureOrBuilder;
import vectortile.model.VectorTile;
import vectortile.value.Value;
import vectortile.value.ValueOrBuilder;

/**
 * @Author jlj
 * @Date 2020/12/28 11:53
 * @Description Layers are described in section 4.1 of the specification
 * Protobuf type {@code Layer}
 * @Modified
 */
public final class Layer extends GeneratedMessageV3.ExtendableMessage<Layer>
        implements LayerOrBuilder {
    private static final long serialVersionUID = 0L;

    // Use Layer.newBuilder() to construct.
    private Layer(GeneratedMessageV3.ExtendableBuilder<Layer, ?> builder) {
        super(builder);
    }

    private Layer() {
        version_ = 1;
        name_ = "";
        features_ = java.util.Collections.emptyList();
        keys_ = LazyStringArrayList.EMPTY;
        values_ = java.util.Collections.emptyList();
        extent_ = 4096;
    }

    @java.lang.Override
    public final UnknownFieldSet getUnknownFields() {
        return this.unknownFields;
    }

    private Layer(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        this();
        if (extensionRegistry == null) {
            throw new java.lang.NullPointerException();
        }
        int mutable_bitField0_ = 0;
        UnknownFieldSet.Builder unknownFields = UnknownFieldSet.newBuilder();
        try {
            boolean done = false;
            while (!done) {
                int tag = input.readTag();
                switch (tag) {
                    case 0:
                        done = true;
                        break;
                    case 10: {
                        ByteString bs = input.readBytes();
                        bitField0_ |= 0x00000002;
                        name_ = bs;
                        break;
                    }
                    case 18: {
                        if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
                            features_ = new java.util.ArrayList<Feature>();
                            mutable_bitField0_ |= 0x00000004;
                        }
                        features_.add(
                                input.readMessage(Feature.PARSER, extensionRegistry));
                        break;
                    }
                    case 26: {
                        ByteString bs = input.readBytes();
                        if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                            keys_ = new LazyStringArrayList();
                            mutable_bitField0_ |= 0x00000008;
                        }
                        keys_.add(bs);
                        break;
                    }
                    case 34: {
                        if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
                            values_ = new java.util.ArrayList<Value>();
                            mutable_bitField0_ |= 0x00000010;
                        }
                        values_.add(
                                input.readMessage(Value.PARSER, extensionRegistry));
                        break;
                    }
                    case 40: {
                        bitField0_ |= 0x00000004;
                        extent_ = input.readUInt32();
                        break;
                    }
                    case 120: {
                        bitField0_ |= 0x00000001;
                        version_ = input.readUInt32();
                        break;
                    }
                    default: {
                        if (!parseUnknownField(
                                input, unknownFields, extensionRegistry, tag)) {
                            done = true;
                        }
                        break;
                    }
                }
            }
        } catch (InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
            throw new InvalidProtocolBufferException(
                    e).setUnfinishedMessage(this);
        } finally {
            if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
                features_ = java.util.Collections.unmodifiableList(features_);
            }
            if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                keys_ = keys_.getUnmodifiableView();
            }
            if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
                values_ = java.util.Collections.unmodifiableList(values_);
            }
            this.unknownFields = unknownFields.build();
            makeExtensionsImmutable();
        }
    }

    public static final Descriptors.Descriptor
    getDescriptor() {
        return VectorTile.internal_static_vector_tile_Tile_Layer_descriptor;
    }

    @java.lang.Override
    protected GeneratedMessageV3.FieldAccessorTable
    internalGetFieldAccessorTable() {
        return VectorTile.internal_static_vector_tile_Tile_Layer_fieldAccessorTable.ensureFieldAccessorsInitialized(
                Layer.class, Layer.Builder.class);
    }

    private int bitField0_;
    public static final int VERSION_FIELD_NUMBER = 15;
    private int version_;

    /**
     * <pre>
     * Any compliant implementation must first read the version
     * number encoded in this message and choose the correct
     * implementation for this version number before proceeding to
     * decode other parts of this message.
     * </pre>
     *
     * <code>required uint32 version = 15 [default = 1];</code>
     */
    public boolean hasVersion() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
    }

    /**
     * <pre>
     * Any compliant implementation must first read the version
     * number encoded in this message and choose the correct
     * implementation for this version number before proceeding to
     * decode other parts of this message.
     * </pre>
     *
     * <code>required uint32 version = 15 [default = 1];</code>
     */
    public int getVersion() {
        return version_;
    }

    public static final int NAME_FIELD_NUMBER = 1;
    private volatile java.lang.Object name_;

    /**
     * <code>required string name = 1;</code>
     */
    public boolean hasName() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
    }

    /**
     * <code>required string name = 1;</code>
     */
    public java.lang.String getName() {
        java.lang.Object ref = name_;
        if (ref instanceof java.lang.String) {
            return (java.lang.String) ref;
        } else {
            ByteString bs = (ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            if (bs.isValidUtf8()) {
                name_ = s;
            }
            return s;
        }
    }

    /**
     * <code>required string name = 1;</code>
     */
    public ByteString getNameBytes() {
        java.lang.Object ref = name_;
        if (ref instanceof java.lang.String) {
            ByteString b = ByteString.copyFromUtf8((java.lang.String) ref);
            name_ = b;
            return b;
        } else {
            return (ByteString) ref;
        }
    }

    public static final int FEATURES_FIELD_NUMBER = 2;
    private java.util.List<Feature> features_;

    /**
     * <pre>
     * The actual features in this tile.
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
     */
    public java.util.List<Feature> getFeaturesList() {
        return features_;
    }

    /**
     * <pre>
     * The actual features in this tile.
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
     */
    public java.util.List<? extends FeatureOrBuilder> getFeaturesOrBuilderList() {
        return features_;
    }

    /**
     * <pre>
     * The actual features in this tile.
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
     */
    public int getFeaturesCount() {
        return features_.size();
    }

    /**
     * <pre>
     * The actual features in this tile.
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
     */
    public Feature getFeatures(int index) {
        return features_.get(index);
    }

    /**
     * <pre>
     * The actual features in this tile.
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
     */
    public FeatureOrBuilder getFeaturesOrBuilder(int index) {
        return features_.get(index);
    }

    public static final int KEYS_FIELD_NUMBER = 3;
    private LazyStringList keys_;

    /**
     * <pre>
     * Dictionary encoding for keys
     * </pre>
     *
     * <code>repeated string keys = 3;</code>
     */
    public ProtocolStringList getKeysList() {
        return keys_;
    }

    /**
     * <pre>
     * Dictionary encoding for keys
     * </pre>
     *
     * <code>repeated string keys = 3;</code>
     */
    public int getKeysCount() {
        return keys_.size();
    }

    /**
     * <pre>
     * Dictionary encoding for keys
     * </pre>
     *
     * <code>repeated string keys = 3;</code>
     */
    public java.lang.String getKeys(int index) {
        return keys_.get(index);
    }

    /**
     * <pre>
     * Dictionary encoding for keys
     * </pre>
     *
     * <code>repeated string keys = 3;</code>
     */
    public ByteString getKeysBytes(int index) {
        return keys_.getByteString(index);
    }

    public static final int VALUES_FIELD_NUMBER = 4;
    private java.util.List<Value> values_;

    /**
     * <pre>
     * Dictionary encoding for values
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Value values = 4;</code>
     */
    public java.util.List<Value> getValuesList() {
        return values_;
    }

    /**
     * <pre>
     * Dictionary encoding for values
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Value values = 4;</code>
     */
    public java.util.List<? extends ValueOrBuilder> getValuesOrBuilderList() {
        return values_;
    }

    /**
     * <pre>
     * Dictionary encoding for values
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Value values = 4;</code>
     */
    public int getValuesCount() {
        return values_.size();
    }

    /**
     * <pre>
     * Dictionary encoding for values
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Value values = 4;</code>
     */
    public Value getValues(int index) {
        return values_.get(index);
    }

    /**
     * <pre>
     * Dictionary encoding for values
     * </pre>
     *
     * <code>repeated .vector_tile.Tile.Value values = 4;</code>
     */
    public ValueOrBuilder getValuesOrBuilder(int index) {
        return values_.get(index);
    }

    public static final int EXTENT_FIELD_NUMBER = 5;
    private int extent_;

    /**
     * <pre>
     * Although this is an "optional" field it is required by the specification.
     * See https://github.com/mapbox/vector-tile-spec/issues/47
     * </pre>
     *
     * <code>optional uint32 extent = 5 [default = 4096];</code>
     */
    public boolean hasExtent() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
    }

    /**
     * <pre>
     * Although this is an "optional" field it is required by the specification.
     * See https://github.com/mapbox/vector-tile-spec/issues/47
     * </pre>
     *
     * <code>optional uint32 extent = 5 [default = 4096];</code>
     */
    public int getExtent() {
        return extent_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
        byte isInitialized = memoizedIsInitialized;
        if (isInitialized == 1) return true;
        if (isInitialized == 0) return false;

        if (!hasVersion()) {
            memoizedIsInitialized = 0;
            return false;
        }
        if (!hasName()) {
            memoizedIsInitialized = 0;
            return false;
        }
        for (int i = 0; i < getValuesCount(); i++) {
            if (!getValues(i).isInitialized()) {
                memoizedIsInitialized = 0;
                return false;
            }
        }
        if (!extensionsAreInitialized()) {
            memoizedIsInitialized = 0;
            return false;
        }
        memoizedIsInitialized = 1;
        return true;
    }

    @java.lang.Override
    public void writeTo(CodedOutputStream output) throws java.io.IOException {
        GeneratedMessageV3.ExtendableMessage<Layer>.ExtensionWriter extensionWriter = newExtensionWriter();
        if (((bitField0_ & 0x00000002) == 0x00000002)) {
            GeneratedMessageV3.writeString(output, 1, name_);
        }
        for (int i = 0; i < features_.size(); i++) {
            output.writeMessage(2, features_.get(i));
        }
        for (int i = 0; i < keys_.size(); i++) {
            GeneratedMessageV3.writeString(output, 3, keys_.getRaw(i));
        }
        for (int i = 0; i < values_.size(); i++) {
            output.writeMessage(4, values_.get(i));
        }
        if (((bitField0_ & 0x00000004) == 0x00000004)) {
            output.writeUInt32(5, extent_);
        }
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
            output.writeUInt32(15, version_);
        }
        extensionWriter.writeUntil(536870912, output);
        unknownFields.writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
        int size = memoizedSize;
        if (size != -1) return size;

        size = 0;
        if (((bitField0_ & 0x00000002) == 0x00000002)) {
            size += GeneratedMessageV3.computeStringSize(1, name_);
        }
        for (int i = 0; i < features_.size(); i++) {
            size += CodedOutputStream
                    .computeMessageSize(2, features_.get(i));
        }
        {
            int dataSize = 0;
            for (int i = 0; i < keys_.size(); i++) {
                dataSize += computeStringSizeNoTag(keys_.getRaw(i));
            }
            size += dataSize;
            size += 1 * getKeysList().size();
        }
        for (int i = 0; i < values_.size(); i++) {
            size += CodedOutputStream
                    .computeMessageSize(4, values_.get(i));
        }
        if (((bitField0_ & 0x00000004) == 0x00000004)) {
            size += CodedOutputStream
                    .computeUInt32Size(5, extent_);
        }
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
            size += CodedOutputStream
                    .computeUInt32Size(15, version_);
        }
        size += extensionsSerializedSize();
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof Layer)) {
            return super.equals(obj);
        }
        Layer other = (Layer) obj;

        boolean result = true;
        result = result && (hasVersion() == other.hasVersion());
        if (hasVersion()) {
            result = result && (getVersion() == other.getVersion());
        }
        result = result && (hasName() == other.hasName());
        if (hasName()) {
            result = result && getName().equals(other.getName());
        }
        result = result && getFeaturesList().equals(other.getFeaturesList());
        result = result && getKeysList().equals(other.getKeysList());
        result = result && getValuesList().equals(other.getValuesList());
        result = result && (hasExtent() == other.hasExtent());
        if (hasExtent()) {
            result = result && (getExtent() == other.getExtent());
        }
        result = result && unknownFields.equals(other.unknownFields);
        result = result && getExtensionFields().equals(other.getExtensionFields());
        return result;
    }

    @java.lang.Override
    public int hashCode() {
        if (memoizedHashCode != 0) {
            return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        if (hasVersion()) {
            hash = (37 * hash) + VERSION_FIELD_NUMBER;
            hash = (53 * hash) + getVersion();
        }
        if (hasName()) {
            hash = (37 * hash) + NAME_FIELD_NUMBER;
            hash = (53 * hash) + getName().hashCode();
        }
        if (getFeaturesCount() > 0) {
            hash = (37 * hash) + FEATURES_FIELD_NUMBER;
            hash = (53 * hash) + getFeaturesList().hashCode();
        }
        if (getKeysCount() > 0) {
            hash = (37 * hash) + KEYS_FIELD_NUMBER;
            hash = (53 * hash) + getKeysList().hashCode();
        }
        if (getValuesCount() > 0) {
            hash = (37 * hash) + VALUES_FIELD_NUMBER;
            hash = (53 * hash) + getValuesList().hashCode();
        }
        if (hasExtent()) {
            hash = (37 * hash) + EXTENT_FIELD_NUMBER;
            hash = (53 * hash) + getExtent();
        }
        hash = hashFields(hash, getExtensionFields());
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
    }

    public static Layer parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static Layer parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Layer parseFrom(ByteString data) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static Layer parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Layer parseFrom(byte[] data) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static Layer parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Layer parseFrom(java.io.InputStream input) throws java.io.IOException {
        return GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static Layer parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
        return GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static Layer parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
        return GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static Layer parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
        return GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }

    public static Layer parseFrom(CodedInputStream input) throws java.io.IOException {
        return GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static Layer parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
        return GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
        return newBuilder();
    }

    public static Builder newBuilder() {
        return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(Layer prototype) {
        return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
        return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent) {
        Builder builder = new Builder(parent);
        return builder;
    }

    /**
     * <pre>
     * Layers are described in section 4.1 of the specification
     * </pre>
     * <p>
     * Protobuf type {@code vector_tile.Tile.Layer}
     */
    public static final class Builder extends GeneratedMessageV3.ExtendableBuilder<Layer, Builder> implements LayerOrBuilder {
        public static final Descriptors.Descriptor getDescriptor() {
            return VectorTile.internal_static_vector_tile_Tile_Layer_descriptor;
        }

        @java.lang.Override
        protected GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
            return VectorTile.internal_static_vector_tile_Tile_Layer_fieldAccessorTable.ensureFieldAccessorsInitialized(
                    Layer.class, Layer.Builder.class);
        }

        // Construct using vector_tile.VectorTile.Tile.Layer.newBuilder()
        private Builder() {
            maybeForceBuilderInitialization();
        }

        private Builder(GeneratedMessageV3.BuilderParent parent) {
            super(parent);
            maybeForceBuilderInitialization();
        }

        private void maybeForceBuilderInitialization() {
            if (GeneratedMessageV3.alwaysUseFieldBuilders) {
                getFeaturesFieldBuilder();
                getValuesFieldBuilder();
            }
        }

        @java.lang.Override
        public Builder clear() {
            super.clear();
            version_ = 1;
            bitField0_ = (bitField0_ & ~0x00000001);
            name_ = "";
            bitField0_ = (bitField0_ & ~0x00000002);
            if (featuresBuilder_ == null) {
                features_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000004);
            } else {
                featuresBuilder_.clear();
            }
            keys_ = LazyStringArrayList.EMPTY;
            bitField0_ = (bitField0_ & ~0x00000008);
            if (valuesBuilder_ == null) {
                values_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000010);
            } else {
                valuesBuilder_.clear();
            }
            extent_ = 4096;
            bitField0_ = (bitField0_ & ~0x00000020);
            return this;
        }

        @java.lang.Override
        public Descriptors.Descriptor
        getDescriptorForType() {
            return VectorTile.internal_static_vector_tile_Tile_Layer_descriptor;
        }

        @java.lang.Override
        public Layer getDefaultInstanceForType() {
            return Layer.getDefaultInstance();
        }

        @java.lang.Override
        public Layer build() {
            Layer result = buildPartial();
            if (!result.isInitialized()) {
                throw newUninitializedMessageException(result);
            }
            return result;
        }

        @java.lang.Override
        public Layer buildPartial() {
            Layer result = new Layer(this);
            int from_bitField0_ = bitField0_;
            int to_bitField0_ = 0;
            if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
                to_bitField0_ |= 0x00000001;
            }
            result.version_ = version_;
            if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
                to_bitField0_ |= 0x00000002;
            }
            result.name_ = name_;
            if (featuresBuilder_ == null) {
                if (((bitField0_ & 0x00000004) == 0x00000004)) {
                    features_ = java.util.Collections.unmodifiableList(features_);
                    bitField0_ = (bitField0_ & ~0x00000004);
                }
                result.features_ = features_;
            } else {
                result.features_ = featuresBuilder_.build();
            }
            if (((bitField0_ & 0x00000008) == 0x00000008)) {
                keys_ = keys_.getUnmodifiableView();
                bitField0_ = (bitField0_ & ~0x00000008);
            }
            result.keys_ = keys_;
            if (valuesBuilder_ == null) {
                if (((bitField0_ & 0x00000010) == 0x00000010)) {
                    values_ = java.util.Collections.unmodifiableList(values_);
                    bitField0_ = (bitField0_ & ~0x00000010);
                }
                result.values_ = values_;
            } else {
                result.values_ = valuesBuilder_.build();
            }
            if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
                to_bitField0_ |= 0x00000004;
            }
            result.extent_ = extent_;
            result.bitField0_ = to_bitField0_;
            onBuilt();
            return result;
        }

        @java.lang.Override
        public Builder clone() {
            return (Builder) super.clone();
        }

        @java.lang.Override
        public Builder setField(Descriptors.FieldDescriptor field, java.lang.Object value) {
            return (Builder) super.setField(field, value);
        }

        @java.lang.Override
        public Builder clearField(Descriptors.FieldDescriptor field) {
            return (Builder) super.clearField(field);
        }

        @java.lang.Override
        public Builder clearOneof(Descriptors.OneofDescriptor oneof) {
            return (Builder) super.clearOneof(oneof);
        }

        @java.lang.Override
        public Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
            return (Builder) super.setRepeatedField(field, index, value);
        }

        @java.lang.Override
        public Builder addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value) {
            return (Builder) super.addRepeatedField(field, value);
        }

        @java.lang.Override
        public <Type> Builder setExtension(GeneratedMessage.GeneratedExtension<Layer, Type> extension, Type value) {
            return (Builder) super.setExtension(extension, value);
        }

        @java.lang.Override
        public <Type> Builder setExtension(GeneratedMessage.GeneratedExtension<Layer, java.util.List<Type>> extension, int index, Type value) {
            return (Builder) super.setExtension(extension, index, value);
        }

        @java.lang.Override
        public <Type> Builder addExtension(GeneratedMessage.GeneratedExtension<Layer, java.util.List<Type>> extension, Type value) {
            return (Builder) super.addExtension(extension, value);
        }

        @java.lang.Override
        public <Type> Builder clearExtension(GeneratedMessage.GeneratedExtension<Layer, ?> extension) {
            return (Builder) super.clearExtension(extension);
        }

        @java.lang.Override
        public Builder mergeFrom(Message other) {
            if (other instanceof Layer) {
                return mergeFrom((Layer) other);
            } else {
                super.mergeFrom(other);
                return this;
            }
        }

        public Builder mergeFrom(Layer other) {
            if (other == Layer.getDefaultInstance()) return this;
            if (other.hasVersion()) {
                setVersion(other.getVersion());
            }
            if (other.hasName()) {
                bitField0_ |= 0x00000002;
                name_ = other.name_;
                onChanged();
            }
            if (featuresBuilder_ == null) {
                if (!other.features_.isEmpty()) {
                    if (features_.isEmpty()) {
                        features_ = other.features_;
                        bitField0_ = (bitField0_ & ~0x00000004);
                    } else {
                        ensureFeaturesIsMutable();
                        features_.addAll(other.features_);
                    }
                    onChanged();
                }
            } else {
                if (!other.features_.isEmpty()) {
                    if (featuresBuilder_.isEmpty()) {
                        featuresBuilder_.dispose();
                        featuresBuilder_ = null;
                        features_ = other.features_;
                        bitField0_ = (bitField0_ & ~0x00000004);
                        featuresBuilder_ = GeneratedMessageV3.alwaysUseFieldBuilders ? getFeaturesFieldBuilder() : null;
                    } else {
                        featuresBuilder_.addAllMessages(other.features_);
                    }
                }
            }
            if (!other.keys_.isEmpty()) {
                if (keys_.isEmpty()) {
                    keys_ = other.keys_;
                    bitField0_ = (bitField0_ & ~0x00000008);
                } else {
                    ensureKeysIsMutable();
                    keys_.addAll(other.keys_);
                }
                onChanged();
            }
            if (valuesBuilder_ == null) {
                if (!other.values_.isEmpty()) {
                    if (values_.isEmpty()) {
                        values_ = other.values_;
                        bitField0_ = (bitField0_ & ~0x00000010);
                    } else {
                        ensureValuesIsMutable();
                        values_.addAll(other.values_);
                    }
                    onChanged();
                }
            } else {
                if (!other.values_.isEmpty()) {
                    if (valuesBuilder_.isEmpty()) {
                        valuesBuilder_.dispose();
                        valuesBuilder_ = null;
                        values_ = other.values_;
                        bitField0_ = (bitField0_ & ~0x00000010);
                        valuesBuilder_ = GeneratedMessageV3.alwaysUseFieldBuilders ? getValuesFieldBuilder() : null;
                    } else {
                        valuesBuilder_.addAllMessages(other.values_);
                    }
                }
            }
            if (other.hasExtent()) {
                setExtent(other.getExtent());
            }
            this.mergeExtensionFields(other);
            this.mergeUnknownFields(other.unknownFields);
            onChanged();
            return this;
        }

        @java.lang.Override
        public final boolean isInitialized() {
            if (!hasVersion()) {
                return false;
            }
            if (!hasName()) {
                return false;
            }
            for (int i = 0; i < getValuesCount(); i++) {
                if (!getValues(i).isInitialized()) {
                    return false;
                }
            }
            if (!extensionsAreInitialized()) {
                return false;
            }
            return true;
        }

        @java.lang.Override
        public Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
            Layer parsedMessage = null;
            try {
                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
            } catch (InvalidProtocolBufferException e) {
                parsedMessage = (Layer) e.getUnfinishedMessage();
                throw e.unwrapIOException();
            } finally {
                if (parsedMessage != null) {
                    mergeFrom(parsedMessage);
                }
            }
            return this;
        }

        private int bitField0_;

        private int version_ = 1;

        /**
         * <pre>
         * Any compliant implementation must first read the version
         * number encoded in this message and choose the correct
         * implementation for this version number before proceeding to
         * decode other parts of this message.
         * </pre>
         *
         * <code>required uint32 version = 15 [default = 1];</code>
         */
        public boolean hasVersion() {
            return ((bitField0_ & 0x00000001) == 0x00000001);
        }

        /**
         * <pre>
         * Any compliant implementation must first read the version
         * number encoded in this message and choose the correct
         * implementation for this version number before proceeding to
         * decode other parts of this message.
         * </pre>
         *
         * <code>required uint32 version = 15 [default = 1];</code>
         */
        public int getVersion() {
            return version_;
        }

        /**
         * <pre>
         * Any compliant implementation must first read the version
         * number encoded in this message and choose the correct
         * implementation for this version number before proceeding to
         * decode other parts of this message.
         * </pre>
         *
         * <code>required uint32 version = 15 [default = 1];</code>
         */
        public Builder setVersion(int value) {
            bitField0_ |= 0x00000001;
            version_ = value;
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Any compliant implementation must first read the version
         * number encoded in this message and choose the correct
         * implementation for this version number before proceeding to
         * decode other parts of this message.
         * </pre>
         *
         * <code>required uint32 version = 15 [default = 1];</code>
         */
        public Builder clearVersion() {
            bitField0_ = (bitField0_ & ~0x00000001);
            version_ = 1;
            onChanged();
            return this;
        }

        private java.lang.Object name_ = "";

        /**
         * <code>required string name = 1;</code>
         */
        public boolean hasName() {
            return ((bitField0_ & 0x00000002) == 0x00000002);
        }

        /**
         * <code>required string name = 1;</code>
         */
        public java.lang.String getName() {
            java.lang.Object ref = name_;
            if (!(ref instanceof java.lang.String)) {
                ByteString bs = (ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                if (bs.isValidUtf8()) {
                    name_ = s;
                }
                return s;
            } else {
                return (java.lang.String) ref;
            }
        }

        /**
         * <code>required string name = 1;</code>
         */
        public ByteString getNameBytes() {
            java.lang.Object ref = name_;
            if (ref instanceof String) {
                ByteString b = ByteString.copyFromUtf8(
                        (java.lang.String) ref);
                name_ = b;
                return b;
            } else {
                return (ByteString) ref;
            }
        }

        /**
         * <code>required string name = 1;</code>
         */
        public Builder setName(java.lang.String value) {
            if (value == null) {
                throw new NullPointerException();
            }
            bitField0_ |= 0x00000002;
            name_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>required string name = 1;</code>
         */
        public Builder clearName() {
            bitField0_ = (bitField0_ & ~0x00000002);
            name_ = getDefaultInstance().getName();
            onChanged();
            return this;
        }

        /**
         * <code>required string name = 1;</code>
         */
        public Builder setNameBytes(ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            bitField0_ |= 0x00000002;
            name_ = value;
            onChanged();
            return this;
        }

        private java.util.List<Feature> features_ = java.util.Collections.emptyList();

        private void ensureFeaturesIsMutable() {
            if (!((bitField0_ & 0x00000004) == 0x00000004)) {
                features_ = new java.util.ArrayList<Feature>(features_);
                bitField0_ |= 0x00000004;
            }
        }

        private RepeatedFieldBuilderV3<Feature, Feature.Builder, FeatureOrBuilder> featuresBuilder_;

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public java.util.List<Feature> getFeaturesList() {
            if (featuresBuilder_ == null) {
                return java.util.Collections.unmodifiableList(features_);
            } else {
                return featuresBuilder_.getMessageList();
            }
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public int getFeaturesCount() {
            if (featuresBuilder_ == null) {
                return features_.size();
            } else {
                return featuresBuilder_.getCount();
            }
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Feature getFeatures(int index) {
            if (featuresBuilder_ == null) {
                return features_.get(index);
            } else {
                return featuresBuilder_.getMessage(index);
            }
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder setFeatures(int index, Feature value) {
            if (featuresBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureFeaturesIsMutable();
                features_.set(index, value);
                onChanged();
            } else {
                featuresBuilder_.setMessage(index, value);
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder setFeatures(int index, Feature.Builder builderForValue) {
            if (featuresBuilder_ == null) {
                ensureFeaturesIsMutable();
                features_.set(index, builderForValue.build());
                onChanged();
            } else {
                featuresBuilder_.setMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder addFeatures(Feature value) {
            if (featuresBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureFeaturesIsMutable();
                features_.add(value);
                onChanged();
            } else {
                featuresBuilder_.addMessage(value);
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder addFeatures(int index, Feature value) {
            if (featuresBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureFeaturesIsMutable();
                features_.add(index, value);
                onChanged();
            } else {
                featuresBuilder_.addMessage(index, value);
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder addFeatures(Feature.Builder builderForValue) {
            if (featuresBuilder_ == null) {
                ensureFeaturesIsMutable();
                features_.add(builderForValue.build());
                onChanged();
            } else {
                featuresBuilder_.addMessage(builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder addFeatures(int index, Feature.Builder builderForValue) {
            if (featuresBuilder_ == null) {
                ensureFeaturesIsMutable();
                features_.add(index, builderForValue.build());
                onChanged();
            } else {
                featuresBuilder_.addMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder addAllFeatures(java.lang.Iterable<? extends Feature> values) {
            if (featuresBuilder_ == null) {
                ensureFeaturesIsMutable();
                AbstractMessageLite.Builder.addAll(values, features_);
                onChanged();
            } else {
                featuresBuilder_.addAllMessages(values);
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder clearFeatures() {
            if (featuresBuilder_ == null) {
                features_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000004);
                onChanged();
            } else {
                featuresBuilder_.clear();
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Builder removeFeatures(int index) {
            if (featuresBuilder_ == null) {
                ensureFeaturesIsMutable();
                features_.remove(index);
                onChanged();
            } else {
                featuresBuilder_.remove(index);
            }
            return this;
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Feature.Builder getFeaturesBuilder(int index) {
            return getFeaturesFieldBuilder().getBuilder(index);
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public FeatureOrBuilder getFeaturesOrBuilder(
                int index) {
            if (featuresBuilder_ == null) {
                return features_.get(index);
            } else {
                return featuresBuilder_.getMessageOrBuilder(index);
            }
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public java.util.List<? extends FeatureOrBuilder>
        getFeaturesOrBuilderList() {
            if (featuresBuilder_ != null) {
                return featuresBuilder_.getMessageOrBuilderList();
            } else {
                return java.util.Collections.unmodifiableList(features_);
            }
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Feature.Builder addFeaturesBuilder() {
            return getFeaturesFieldBuilder().addBuilder(Feature.getDefaultInstance());
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public Feature.Builder addFeaturesBuilder(int index) {
            return getFeaturesFieldBuilder().addBuilder(index, Feature.getDefaultInstance());
        }

        /**
         * <pre>
         * The actual features in this tile.
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Feature features = 2;</code>
         */
        public java.util.List<Feature.Builder> getFeaturesBuilderList() {
            return getFeaturesFieldBuilder().getBuilderList();
        }

        private RepeatedFieldBuilderV3<Feature, Feature.Builder, FeatureOrBuilder>
        getFeaturesFieldBuilder() {
            if (featuresBuilder_ == null) {
                featuresBuilder_ = new RepeatedFieldBuilderV3<Feature, Feature.Builder, FeatureOrBuilder>(
                        features_,
                        ((bitField0_ & 0x00000004) == 0x00000004),
                        getParentForChildren(),
                        isClean());
                features_ = null;
            }
            return featuresBuilder_;
        }

        private LazyStringList keys_ = LazyStringArrayList.EMPTY;

        private void ensureKeysIsMutable() {
            if (!((bitField0_ & 0x00000008) == 0x00000008)) {
                keys_ = new LazyStringArrayList(keys_);
                bitField0_ |= 0x00000008;
            }
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public ProtocolStringList getKeysList() {
            return keys_.getUnmodifiableView();
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public int getKeysCount() {
            return keys_.size();
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public java.lang.String getKeys(int index) {
            return keys_.get(index);
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public ByteString getKeysBytes(int index) {
            return keys_.getByteString(index);
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public Builder setKeys(int index, java.lang.String value) {
            if (value == null) {
                throw new NullPointerException();
            }
            ensureKeysIsMutable();
            keys_.set(index, value);
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public Builder addKeys(java.lang.String value) {
            if (value == null) {
                throw new NullPointerException();
            }
            ensureKeysIsMutable();
            keys_.add(value);
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public Builder addAllKeys(java.lang.Iterable<java.lang.String> values) {
            ensureKeysIsMutable();
            AbstractMessageLite.Builder.addAll(values, keys_);
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public Builder clearKeys() {
            keys_ = LazyStringArrayList.EMPTY;
            bitField0_ = (bitField0_ & ~0x00000008);
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for keys
         * </pre>
         *
         * <code>repeated string keys = 3;</code>
         */
        public Builder addKeysBytes(ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            ensureKeysIsMutable();
            keys_.add(value);
            onChanged();
            return this;
        }

        private java.util.List<Value> values_ = java.util.Collections.emptyList();

        private void ensureValuesIsMutable() {
            if (!((bitField0_ & 0x00000010) == 0x00000010)) {
                values_ = new java.util.ArrayList<Value>(values_);
                bitField0_ |= 0x00000010;
            }
        }

        private RepeatedFieldBuilderV3<Value, Value.Builder, ValueOrBuilder> valuesBuilder_;

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public java.util.List<Value> getValuesList() {
            if (valuesBuilder_ == null) {
                return java.util.Collections.unmodifiableList(values_);
            } else {
                return valuesBuilder_.getMessageList();
            }
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public int getValuesCount() {
            if (valuesBuilder_ == null) {
                return values_.size();
            } else {
                return valuesBuilder_.getCount();
            }
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Value getValues(int index) {
            if (valuesBuilder_ == null) {
                return values_.get(index);
            } else {
                return valuesBuilder_.getMessage(index);
            }
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder setValues(int index, Value value) {
            if (valuesBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureValuesIsMutable();
                values_.set(index, value);
                onChanged();
            } else {
                valuesBuilder_.setMessage(index, value);
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder setValues(int index, Value.Builder builderForValue) {
            if (valuesBuilder_ == null) {
                ensureValuesIsMutable();
                values_.set(index, builderForValue.build());
                onChanged();
            } else {
                valuesBuilder_.setMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder addValues(Value value) {
            if (valuesBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureValuesIsMutable();
                values_.add(value);
                onChanged();
            } else {
                valuesBuilder_.addMessage(value);
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder addValues(int index, Value value) {
            if (valuesBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureValuesIsMutable();
                values_.add(index, value);
                onChanged();
            } else {
                valuesBuilder_.addMessage(index, value);
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder addValues(Value.Builder builderForValue) {
            if (valuesBuilder_ == null) {
                ensureValuesIsMutable();
                values_.add(builderForValue.build());
                onChanged();
            } else {
                valuesBuilder_.addMessage(builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder addValues(int index, Value.Builder builderForValue) {
            if (valuesBuilder_ == null) {
                ensureValuesIsMutable();
                values_.add(index, builderForValue.build());
                onChanged();
            } else {
                valuesBuilder_.addMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder addAllValues(java.lang.Iterable<? extends Value> values) {
            if (valuesBuilder_ == null) {
                ensureValuesIsMutable();
                AbstractMessageLite.Builder.addAll(values, values_);
                onChanged();
            } else {
                valuesBuilder_.addAllMessages(values);
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder clearValues() {
            if (valuesBuilder_ == null) {
                values_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000010);
                onChanged();
            } else {
                valuesBuilder_.clear();
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Builder removeValues(int index) {
            if (valuesBuilder_ == null) {
                ensureValuesIsMutable();
                values_.remove(index);
                onChanged();
            } else {
                valuesBuilder_.remove(index);
            }
            return this;
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Value.Builder getValuesBuilder(int index) {
            return getValuesFieldBuilder().getBuilder(index);
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public ValueOrBuilder getValuesOrBuilder(int index) {
            if (valuesBuilder_ == null) {
                return values_.get(index);
            } else {
                return valuesBuilder_.getMessageOrBuilder(index);
            }
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public java.util.List<? extends ValueOrBuilder>
        getValuesOrBuilderList() {
            if (valuesBuilder_ != null) {
                return valuesBuilder_.getMessageOrBuilderList();
            } else {
                return java.util.Collections.unmodifiableList(values_);
            }
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Value.Builder addValuesBuilder() {
            return getValuesFieldBuilder().addBuilder(Value.getDefaultInstance());
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public Value.Builder addValuesBuilder(int index) {
            return getValuesFieldBuilder().addBuilder(index, Value.getDefaultInstance());
        }

        /**
         * <pre>
         * Dictionary encoding for values
         * </pre>
         *
         * <code>repeated .vector_tile.Tile.Value values = 4;</code>
         */
        public java.util.List<Value.Builder> getValuesBuilderList() {
            return getValuesFieldBuilder().getBuilderList();
        }

        private RepeatedFieldBuilderV3<Value, Value.Builder, ValueOrBuilder>
        getValuesFieldBuilder() {
            if (valuesBuilder_ == null) {
                valuesBuilder_ = new RepeatedFieldBuilderV3<Value, Value.Builder, ValueOrBuilder>(
                        values_,
                        ((bitField0_ & 0x00000010) == 0x00000010),
                        getParentForChildren(),
                        isClean());
                values_ = null;
            }
            return valuesBuilder_;
        }

        private int extent_ = 4096;

        /**
         * <pre>
         * Although this is an "optional" field it is required by the specification.
         * See https://github.com/mapbox/vector-tile-spec/issues/47
         * </pre>
         *
         * <code>optional uint32 extent = 5 [default = 4096];</code>
         */
        public boolean hasExtent() {
            return ((bitField0_ & 0x00000020) == 0x00000020);
        }

        /**
         * <pre>
         * Although this is an "optional" field it is required by the specification.
         * See https://github.com/mapbox/vector-tile-spec/issues/47
         * </pre>
         *
         * <code>optional uint32 extent = 5 [default = 4096];</code>
         */
        public int getExtent() {
            return extent_;
        }

        /**
         * <pre>
         * Although this is an "optional" field it is required by the specification.
         * See https://github.com/mapbox/vector-tile-spec/issues/47
         * </pre>
         *
         * <code>optional uint32 extent = 5 [default = 4096];</code>
         */
        public Builder setExtent(int value) {
            bitField0_ |= 0x00000020;
            extent_ = value;
            onChanged();
            return this;
        }

        /**
         * <pre>
         * Although this is an "optional" field it is required by the specification.
         * See https://github.com/mapbox/vector-tile-spec/issues/47
         * </pre>
         *
         * <code>optional uint32 extent = 5 [default = 4096];</code>
         */
        public Builder clearExtent() {
            bitField0_ = (bitField0_ & ~0x00000020);
            extent_ = 4096;
            onChanged();
            return this;
        }

        @java.lang.Override
        public final Builder setUnknownFields(final UnknownFieldSet unknownFields) {
            return super.setUnknownFields(unknownFields);
        }

        @java.lang.Override
        public final Builder mergeUnknownFields(final UnknownFieldSet unknownFields) {
            return super.mergeUnknownFields(unknownFields);
        }
    }

    // @@protoc_insertion_point(class_scope:vector_tile.Tile.Layer)
    private static final Layer DEFAULT_INSTANCE;

    static {
        DEFAULT_INSTANCE = new Layer();
    }

    public static Layer getDefaultInstance() {
        return DEFAULT_INSTANCE;
    }

    @java.lang.Deprecated
    public static final Parser<Layer> PARSER = new AbstractParser<Layer>() {
        @java.lang.Override
        public Layer parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
                throws InvalidProtocolBufferException {
            return new Layer(input, extensionRegistry);
        }
    };

    public static Parser<Layer> parser() {
        return PARSER;
    }

    @java.lang.Override
    public Parser<Layer> getParserForType() {
        return PARSER;
    }

    @java.lang.Override
    public Layer getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
    }

}
